package dao;

import java.sql.PreparedStatement;
import beans.ClienteBeans;
import conexao.Conexao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;


public class ClienteDao {
   
    public ClienteDao(){
        
    }
    
    public boolean grava(ClienteBeans cliente){
        boolean gravou = false;
        String sql = "INSERT INTO clientes VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        try {
            PreparedStatement comandoSQL = Conexao.getInstance().prepareStatement(sql);            
            comandoSQL.setInt(1, 0);
            comandoSQL.setString(2, cliente.getNome());
            comandoSQL.setString(3, cliente.getTelefone());
            comandoSQL.setString(4, cliente.getCelular());
            comandoSQL.setString(5, cliente.getEndereco());
            comandoSQL.setString(6, cliente.getComplendereco());
            comandoSQL.setString(7, cliente.getBairro());
            comandoSQL.setString(8, cliente.getCep());
            comandoSQL.setString(9, cliente.getCidade());
            comandoSQL.setString(10, cliente.getUf());
            comandoSQL.setString(11, cliente.getCpf());
            comandoSQL.setString(12, cliente.getRg());
            comandoSQL.setString(13, cliente.getBanco());
            comandoSQL.setString(14, cliente.getContaC());
            comandoSQL.setString(15, cliente.getAgencia());
            comandoSQL.execute();
            Conexao.getInstance().commit();
            gravou = true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return gravou;
    }    
}
